﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Reflection;
using System.Data.DataModel;

namespace System.Data.DataControl
{

    /// <summary>
    /// interface for database controller
    /// </summary>
    public interface IDbController
    {
        /// <summary>
        /// 
        /// </summary>
        string SelectCommand { get; set; }
        /// <summary>
        /// 
        /// </summary>
        string SelectAllCommand { get; set; }
        /// <summary>
        /// 
        /// </summary>
        string UpdateCommand { get; set; }
        /// <summary>
        /// 
        /// </summary>
        string InsertCommand { get; set; }
        /// <summary>
        /// 
        /// </summary>
        string DeleteCommand { get; set; }
        /// <summary>
        /// 
        /// </summary>
        string ErrorMessage { get; set; }
        /// <summary>
        /// 
        /// </summary>
        Data.IDbCommand Command { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        IEnumerable<object> GetAll(object obj);

        /// <summary>
        /// 主キーでのデータ取得
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="primaryKey">主キー名コレクション</param>
        /// <returns></returns>
        IEnumerable<object> GetData(object obj, string[] primaryKey);

        /// <summary>
        /// 任意の条件でのデータ取得
        /// SetParameter(string parameterName, object parameterValue)
        /// でパラメーターを設定してから実行する
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="primaryKey"></param>
        /// <returns></returns>
        IEnumerable<object> GetData(object obj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="primaryKey"></param>
        /// <returns></returns>
        int Insert(object obj, string[] primaryKey);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        int Update(object obj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="primaryKey"></param>
        /// <returns></returns>
        int Delete(object obj, string primaryKey);
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        int CreateTable(bool dropTable, string className, List<PropertySet> properties, string filePath);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="connectionString"></param>
        void SetCommand();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="property"></param>
        /// <param name="obj"></param>
        void SetParameter(PropertyInfo property, object obj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="primaryKey"></param>
        void SetParameters(object obj, string[] primaryKey);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="property"></param>
        /// <param name="obj"></param>
        void SetParameter(string parameterName, object parameterValue);

        void SetTransaction();

        
    }
}
